﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SaleOnlineSystem.Controls
{
    public partial class ImageProduct : System.Web.UI.UserControl
    {
        public string imageproduct;
        public string activespch;
        public string nameproduct;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                DataTable dt = ProductDetail.dt;
                if (dt != null)
                {
                    activespch = dt.Rows[0]["Product_Spch"].ToString();
                    nameproduct = dt.Rows[0]["Product_Name"].ToString();
                    imageproduct = dt.Rows[0]["Product_ImageColor"].ToString();

                    string link = dt.Rows[0]["Product_MultiImage"].ToString();
                    string[] imageslink = link.Split(',');

                    DataTable temp = new DataTable();

                    DataColumn dtColumn = new DataColumn("image");
                    temp.Columns.Add(dtColumn);

                    if (link != "")
                    {

                        for (int i = 0; i < imageslink.Length; i++)
                        {
                            DataRow dtRow = temp.NewRow();
                            dtRow[0] = imageslink[i];
                            temp.Rows.Add(dtRow);
                        }

                        rpt_imageproduct.DataSource = temp;
                        rpt_imageproduct.DataBind();
                    }                   
                }
            }

        }
    }
}